﻿
namespace KlearTweet.Client.DataPresentation
{
    public partial class AccountView
    {
        private Model.Account _entity;

        public AccountView()
        {
            InitializeComponent();
        }

        public Model.Account Entity
        {
            get { return _entity; }
            set
            {
                if (value == null)
                    throw new System.ArgumentNullException("value");
                _entity = value;
                Refresh(); // TODO: Use data-binding!
            }
        }

        private void Refresh()
        {
            if (!string.IsNullOrEmpty(Entity.User.ProfileImageUrl))
                ProfileImageUrl.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri(Entity.User.ProfileImageUrl));

            Text.Clear();
            Text.Add("Account: @" + Entity.User.UserName);
            Text.AddNewLine();
            Text.Add("Real name: " + Entity.User.RealName);
        }
    }
}
